//
//  LpxrViewController.m
//  ObjcGoNew
//
//  Created by 邢伟新 on 2021/5/10.
//

#import "LpxrViewController.h"
#import <Masonry/Masonry.h>

@interface LpxrViewController ()

@end

@implementation LpxrViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.title = @"离屏渲染";
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self _initViews];
}

-(void)_initViews{
    
    {
        //按钮存在背景图片
        UIButton *barrierButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        barrierButton.backgroundColor =[UIColor purpleColor];
        [barrierButton setBackgroundImage:[UIImage imageNamed:@"xing"] forState:(UIControlStateNormal)];
        barrierButton.layer.cornerRadius = 40;
        barrierButton.clipsToBounds = YES;
        [self.view addSubview:barrierButton];
        [barrierButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(100);
            make.height.mas_equalTo(80);
            make.width.mas_equalTo(80);
            make.top.mas_equalTo(95);
        }];
    }
    
    {
        //按钮不存在背景图
        UIButton *barrierButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        barrierButton.backgroundColor =[UIColor purpleColor];
        barrierButton.tag = 1001;
        barrierButton.layer.cornerRadius = 40;
        barrierButton.clipsToBounds = YES;
        [self.view addSubview:barrierButton];
        [barrierButton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(100);
            make.height.mas_equalTo(80);
            make.width.mas_equalTo(80);
            make.top.mas_equalTo(250);
        }];
    }
    {
        //图片+背景色
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectZero];
        imageView.backgroundColor = [UIColor blueColor];
        imageView.image = [UIImage imageNamed:@"xing"];
        [self.view addSubview:imageView];
        imageView.layer.cornerRadius = 75;
        imageView.clipsToBounds = YES;
        [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.mas_equalTo(100);
            make.height.mas_equalTo(150);
            make.width.mas_equalTo(150);
            make.top.mas_equalTo(350);
        }];
        
    }
    {
        //图片+无背景色
        UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectZero];
        imageView.image = [UIImage imageNamed:@"xing"];
        [self.view addSubview:imageView];
        imageView.layer.cornerRadius = 75;
        imageView.clipsToBounds = YES;
        [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            
            make.left.mas_equalTo(100);
            make.height.mas_equalTo(150);
            make.width.mas_equalTo(150);
            make.top.mas_equalTo(550);
        }];
        
    }
    
    
}

@end
